<%@ page contentType="text/html; charset=utf-8" language="java" import="java.util.*" pageEncoding="utf-8" errorPage="" %>
<%@ page import="club325.webchat.servlet.chatcore.ChatRoomManager" %>
<%@ page import="club325.webchat.servlet.log.SessionAttributeManager" %>
<%@ page import="club325.webchat.servlet.log.UserAttribute" %>
<%@ page session="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="Keywords" content="WebChat,Chat" />
<meta http-equiv="Description" content="Chatting on Web" />
<title>聊天成员列表</title>
<script type="text/javascript" src="/WebChat/lib/util.js"></script>
<link href="/WebChat/style/global.css" rel="stylesheet" type="text/css" />
<link href="/WebChat/style/chat_lib.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="userlist">
<% 
	String subject = ChatRoomManager.getURISubject(request); 
	if (subject != null) {
		String[] members = ChatRoomManager.getInstance().getChatRoomMembers(subject); 
		String name = null; 
		String role = null; 
		UserAttribute attribute = null; 
		if (members != null && members.length > 0) { 
%>
  <ul>
  <%
  			for (int i = 0; i < members.length; i++) {
  				name = null; 
				role = null; 
  				if (members[i] != null) {
  					name = members[i];
  					attribute = SessionAttributeManager.getInstance().getUserAttribute(name);
  					if (attribute != null) {
  						role = attribute.getUserRole();
  					}
  				}
  		
  				if (name != null && role != null) {
  					if (role.equals(UserAttribute.USERROLE_ADMIN) || role.equals(UserAttribute.USERROLE_USER)) {
  %>
    <li class=<%= role %>><%= name %> - <a href="javascript:openBareWindow('_blank', '/WebChat/pages/user_info.jsp?name=<%= name %>', 540, 380);">查看资料</a></li>
  <%
  					} else {
  %>
    <li class=<%= role %>><%= name %></li>
  <%
  					}
  				}
  			}
  %>
  </ul>
<%
		} else {
%>
  <h1>当前没有聊天成员...</h1>
<%
		}
	} else {
%>
  <h1>当前该聊天室不可用...</h1>
<%
	}
%>
</div>
</body>
</html>